Skip to content

feat(build): typecheck on TypeScript 7 (Go compiler), tooling stays on TS6 API#103

Merged
agjs merged 1 commit into
mainfrom
feat/typescript-7-migration
Jul 16, 2026
Merged

feat(build): typecheck on TypeScript 7 (Go compiler), tooling stays on TS6 API#103
agjs merged 1 commit into
mainfrom
feat/typescript-7-migration

Conversation

@agjs

@agjs agjs commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Adopts TypeScript 7's native Go compiler for the typecheck (multi-second → ~0.34s) — used by both bun run typecheck (CI/dev) and the build gate (the hot per-cycle typecheck during autonomous builds) — without breaking tooling that needs the TS 6 programmatic API.

Why the split

TS 7 has no stable programmatic API until 7.1, and typescript-eslint + the proptest oracle crash on it (they need ts.createProgram/TypeChecker/ModuleKind). So:

  • typescript stays real 6.0.3require("typescript") gives the full 6.x API to tooling at runtime.
  • @typescript/native (= TS 7) is added as a packages/core dependency (consumers get it too), providing the fast compiler.

Deterministic wiring

Both packages expose a tsc bin, so .bin/tsc is ambiguous. TS 7 is referenced by explicit package path:

  • typecheck script → node_modules/@typescript/native/bin/tsc
  • gate TSC_BINresolveTs7Tsc() — walks up for both the hoisted (monorepo) and direct-child (published install) layouts; a loud (non-silent) fallback to ambient tsc keeps the gate functional rather than crashing if TS 7 is ever absent.

Verification

  • TS 7 honors the gate's exact flags (--strict --noUncheckedIndexedAccess --incremental --tsBuildInfoFile) with identical diagnostics.
  • gate-incremental.test.ts now runs the gate's actual resolved binary (not a hardcoded .bin/tsc); new gate-tool-paths.test.ts covers the resolver across layouts + fallback.
  • Full bun run validate green (gate typechecks generated code on TS 7).
  • Independent reviewer panel: PASS (4/4).

Addresses the TypeScript bump from the dev-toolchain group (#102); the group's TS7-built sonarjs/unicorn remain separate (they need TS 7's runtime API, which our tooling deliberately does not use).

…ays on TS6 API

Adopts TS7's native Go compiler for the ~10x-faster typecheck without breaking
tooling that needs the TS6 programmatic API (TS7 has no stable API until 7.1;
typescript-eslint + the proptest oracle crash on it).

- `typescript` stays real 6.0.3 → require("typescript") gives the full 6.x API to
  typescript-eslint + proptest at runtime.
- `@typescript/native` (= TS7) added as a packages/core DEPENDENCY, so consumers
  get the fast compiler too — the gate typechecks on TS7 everywhere, not just
  in-repo. Both packages expose a `tsc` bin, so .bin/tsc is ambiguous; TS7 is
  referenced by explicit package path:
  * typecheck script → node_modules/@typescript/native/bin/tsc
  * gate TSC_BIN → resolveTs7Tsc() walks up to @typescript/native (defensive
    fallback to plain tsc keeps the gate functional if ever absent).
- Tests: gate-tool-paths.test.ts (TSC_BIN resolves TS7); gate-incremental.test.ts
  now runs the gate's ACTUAL resolved binary, not a hardcoded .bin/tsc.

TS7 verified to honor the gate's flags (--strict --noUncheckedIndexedAccess
--incremental --tsBuildInfoFile) with identical diagnostics. Typecheck: multi-sec
→ ~0.34s. Full `bun run validate` green.
@agjs
agjs force-pushed the feat/typescript-7-migration branch from 49333c5 to a95470d Compare July 16, 2026 12:27
@agjs
agjs merged commit 9654695 into main Jul 16, 2026
8 checks passed
@agjs
agjs deleted the feat/typescript-7-migration branch July 16, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant